Xbasic

{CLOSE_ON_LEAVE}

Syntax

{CLOSE_ON_LEAVE}

Description

Closes a modeless dialog box when the user clicks outside the Xdialog.

Discussion

The {CLOSE_ON_LEAVE} command closes a modeless dialog box when the user clicks outside the Xdialog. It makes an modeless dialog box act like a popup menu, which closes when you click outside it. This technique is used in the script editor when you click the "Open Script/Function" button.

Example

files = <<%str%
apples.txt
oranges.txt
%str%
ui_dlg_box("Position",<<%dlg%
[%P=files%.40file] | <&Files!files>;
| <\>\>>;
| <sticky>;
%dlg%,<<%code%
if a_dlg_button = "files" then
    a_dlg_button = ""
    ui_modeless_dlg_box("Files",<<%dlg%
{position=dropdown}
{nocaption}
{close_on_leave}
{on_key=enter}
[.40,20file^#files!file_*]
%dlg%,<<%code1%
if a_dlg_button = "enter" .or. a_dlg_button = "file_dblclick" .or. a_dlg_button = "" then
    a_dlg_button = ""
    ui_modeless_dlg_close("Files")
end if
%code1%)
else if a_dlg_button = ">>" then
    a_dlg_button = ""
    ui_dlg_box("Files",<<%dlg%
{position=expandright}
[.40,20file^#files] <Close>
%dlg%)
else if a_dlg_button = "sticky" then
    a_dlg_button = ""
    ui_dlg_box("Sticky",<<%dlg%
{position=relative,remember=sticky_window}
{size=remember=sticky_window}
This is a sticky dialog | <Ok>;
{stretch=center}
[.30,10dummy]
%dlg%)
end if
%code%)

Limitations

Desktop applications only

See Also